import os
import random
import shutil
import xml.etree.ElementTree as ET

from utils.utils import get_classes

path = 'crane'

if __name__ == "__main__":
    jpgPath = os.path.join(path, 'JPEGImages')
    deleteFile = os.path.join('',"delete.txt")
    
    #读取要删除的文件列表
    f = open(deleteFile,"r",encoding='UTF-8')
    lines = f.readlines()
    f.close()
    for line in lines:
        fileName = 'crane_' + line.replace('\n','').zfill(6) + '.jpg'
        srcFile = os.path.join(jpgPath,fileName)
        dstPath = os.path.join(path,"JPEGImages_out")
        if not os.path.exists(dstPath):
            os.mkdir(dstPath)
        dstFile = os.path.join(dstPath,fileName)
        shutil.move(srcFile,dstFile)
        print(fileName)
